package com.flexycore.iphone.launch;


import com.flexycore.iphone.model.MediaPlayer;
import com.flexycore.iphone.uikit.UIApplication;
import com.flexycore.iphone.uikit.UIApplicationDelegate;
import com.flexycore.iphone.uikit.UINavigationController;
import com.flexycore.iphone.uikit.UIScreen;
import com.flexycore.iphone.uikit.UIViewController;
import com.flexycore.iphone.uikit.UIWindow;
import com.flexycore.iphone.view.MyView;


public class Launcher extends UIApplicationDelegate {

	private UINavigationController nav;
	
	public Launcher()
	{
	}
	
	public void applicationDidFinishLaunching(UIApplication app)
	{ 
		UIWindow window = new UIWindow();
		window.initWithFrame(UIScreen.mainScreen().bounds());

		/*
		 * Media Player
		 */
		MediaPlayer mp = new MediaPlayer();

		/*
		 * User Interface
		 */
		nav = new UINavigationController();
		UIViewController viewController = new UIViewController();
		viewController.init();
		viewController.setTitle("UIToolBar Usage");
		MyView view = new MyView(mp);
		viewController.setView(view);
		nav.initWithRootViewController(viewController);
		
		mp.setBarButtonVector(view.getBarButtonItems());
		
		window.addSubview(nav.view());
		window.makeKeyAndVisible();
	}
	
}
